package online.longzipeng.back.common.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import online.longzipeng.back.common.enums.ResponseEnum;

/**
 * @Author: lzp
 * @description: 统一异常类
 * @Date: 2022/5/15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MessageException extends RuntimeException {

    String message;
    Integer code;

    public MessageException(ResponseEnum responseEnum) {
        this.message = responseEnum.getMessage();
        this.code = responseEnum.getCode();
    }

    public MessageException(String message) {
        this.message = message;
        this.code = ResponseEnum.FAILED.getCode();
    }

}
